package com.efast.cafe.framework.redis.serializer;


import com.efast.cafe.util.ObjectsTranscoder;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;

/******************************************************************************
 * @File name   :      ListRedisSerializer.java
 *
 * @Author      :      fxm
 *
 * @Date        :      2016-7-6
 *
 * @Copyright Notice: 
 * Copyright (c) 2016 Efast Serv. All  Rights Reserved.
 * This software is published under the terms of the Efast Software
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 * 
 * 
 * ----------------------------------------------------------------------------
 * Date                   Who         Version        Comments
 * 2016-7-6 下午5:52:08        fxm     1.0            Initial Version
 *****************************************************************************/
public class ObjectRedisSerializer implements RedisSerializer<Object>{

	
	/**
	 * {@inheritDoc} 
	 * overridden:
	 * @Date        :      2016-7-6
	 * @see org.springframework.data.redis.serializer.RedisSerializer#deserialize(byte[])
	**/
	@Override
	public Object deserialize(byte[] bytes) throws SerializationException {
			return ObjectsTranscoder.deserializeObject(bytes);
	}

	/**
	 * {@inheritDoc} 
	 * overridden:
	 * @Date        :      2016-7-6
	 * @see org.springframework.data.redis.serializer.RedisSerializer#serialize(java.lang.Object)
	**/
	@Override
	public byte[] serialize(Object object) throws SerializationException {
		  return ObjectsTranscoder.serializeObject(object);
	}

	

}
